package com.cjkj.purchase.service.impl;

import java.util.List;
import com.cjkj.common.utils.DateUtils;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.cjkj.purchase.mapper.PurchaseInfoMapper;
import com.cjkj.purchase.domain.PurchaseInfo;
import com.cjkj.purchase.service.IPurchaseInfoService;

/**
 * 采购材料登记信息Service业务层处理
 * 
 * @author cjkj
 * @date 2025-02-20
 */
@Service
public class PurchaseInfoServiceImpl implements IPurchaseInfoService 
{
    @Resource
    private PurchaseInfoMapper purchaseInfoMapper;

    /**
     * 查询采购材料登记信息
     * 
     * @param purchaseId 采购材料登记信息主键
     * @return 采购材料登记信息
     */
    @Override
    public PurchaseInfo selectPurchaseInfoByPurchaseId(Long purchaseId)
    {
        return purchaseInfoMapper.selectPurchaseInfoByPurchaseId(purchaseId);
    }

    /**
     * 查询采购材料登记信息列表
     * 
     * @param purchaseInfo 采购材料登记信息
     * @return 采购材料登记信息
     */
    @Override
    public List<PurchaseInfo> selectPurchaseInfoList(PurchaseInfo purchaseInfo)
    {
        return purchaseInfoMapper.selectList(purchaseInfo);
    }

    /**
     * 新增采购材料登记信息
     * 
     * @param purchaseInfo 采购材料登记信息
     * @return 结果
     */
    @Override
    public int insertPurchaseInfo(PurchaseInfo purchaseInfo)
    {
        purchaseInfo.setCreateTime(DateUtils.getNowDate());
        return purchaseInfoMapper.insertPurchaseInfo(purchaseInfo);
    }

    /**
     * 修改采购材料登记信息
     * 
     * @param purchaseInfo 采购材料登记信息
     * @return 结果
     */
    @Override
    public int updatePurchaseInfo(PurchaseInfo purchaseInfo)
    {
        purchaseInfo.setUpdateTime(DateUtils.getNowDate());
        return purchaseInfoMapper.updatePurchaseInfo(purchaseInfo);
    }

    /**
     * 批量删除采购材料登记信息
     * 
     * @param purchaseIds 需要删除的采购材料登记信息主键
     * @return 结果
     */
    @Override
    public int deletePurchaseInfoByPurchaseIds(Long[] purchaseIds)
    {
        return purchaseInfoMapper.deletePurchaseInfoByPurchaseIds(purchaseIds);
    }

    /**
     * 删除采购材料登记信息信息
     * 
     * @param purchaseId 采购材料登记信息主键
     * @return 结果
     */
    @Override
    public int deletePurchaseInfoByPurchaseId(Long purchaseId)
    {
        return purchaseInfoMapper.deletePurchaseInfoByPurchaseId(purchaseId);
    }
}
